from time import sleep

from basic.UIParent import UIParent
from basic.utils.asserts import asserts
from commen.page.ann.couponPage import couponPage
from test.help.pocesuiteDome import Steps


class CouponCase(UIParent):
    @classmethod
    def test_coupon(self):
        '''未使用优惠券列表校验'''

        # 是否登录
        Steps.do_login()

        # 点击我的优惠券
        couponPage.clickCoupon()
        sleep(2)
        status = couponPage.ifEmpty()
        print("status:", status)
        if status is False:
            coupon = couponPage.getCoupon()
            asserts.contain(coupon, "有效期", "优惠券未使用列表有券")
        else:
            print("没有可用优惠券！")
"""
        couponText = couponPage.getScreen()
        # 字符串转换列表
        couponList = couponText.split()
        print(couponList)
        List = ['暂无可用票券', '有效期']
        if couponList[0] == List[0]:
            asserts.contain(List[0], couponText, "优惠券未使用列表无券")
        else:
            asserts.contain(List[1], couponText, "优惠券未使用列表有券")
"""

